package ceura.ia.practica.android.listeners;

import android.view.View;
import android.widget.ImageButton;
import ceura.ia.practica.android.brush.Brush;
import ceura.ia.practica.android.ui.LaberintoView;

/**
 * Listener genérico de los botnoes de la barra de herramientas.
 *
 * @author 66785403 (Jorge Madrid Portillo)
 */
public class ButtonListener implements View.OnClickListener {

    private Brush brush;
    private LaberintoView laberintoView;

    public ButtonListener(Brush brush, LaberintoView laberintoView) {
        this.brush = brush;
        this.laberintoView = laberintoView;
    }

    public void onClick(View view) {
        ImageButton button = (ImageButton) view;
        laberintoView.setSelectionMode(false);
        laberintoView.getBarraSuperior().toggle();
        laberintoView.setBrush(brush);
    }
}
